package priv.pront.code.lanqiao.team.comp.mati_2;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @Description:
 * @Author: pront
 * @Time:2023-11-02 20:26
 */
public class P1597_语句解析 {

    static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    static int a, b, c;

    public static void main(String[] args) throws IOException {
        String[] s = bf.readLine().split(";");
        for (int i = 0; i < s.length; i++) {
            if (s[i].charAt(0) == 'a') {
                String last = s[i].substring(s[i].length() - 1);
                if (last.equals("b")) {
                    a = b;
                } else if (last.equals("c")) {
                    a = c;
                } else if (!last.equals("a")) {
                    a = s[i].charAt(s[i].length() - 1) == '=' ? 0 : Integer.parseInt(s[i].substring(s[i].length() - 1));
                }
            } else if (s[i].charAt(0) == 'b') {
                String last = s[i].substring(s[i].length() - 1);
                if (last.equals("a")) {
                    b = a;
                } else if (last.equals("c")) {
                    b = c;
                } else if (!last.equals("b")) {
                    b = s[i].charAt(s[i].length() - 1) == '=' ? 0 : Integer.parseInt(s[i].substring(s[i].length() - 1));
                }

            } else if (s[i].charAt(0) == 'c') {
                String last = s[i].substring(s[i].length() - 1);
                if (last.equals("a")) {
                    c = a;
                } else if (last.equals("b")) {
                    c = b;
                } else if (!last.equals("c")) {
                    c = s[i].charAt(s[i].length() - 1) == '=' ? 0 : Integer.parseInt(s[i].substring(s[i].length() - 1));
                }
            }
        }
        System.out.println(a + " " + b + " " + c);
    }
}
